package pt.nmfa.peste.entity;

// Generated Mar 5, 2011 1:52:20 PM by Hibernate Tools 3.3.0.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * DeviceActions generated by hbm2java
 */
@Entity
@Table(name = "deviceActions", catalog = "HomeDB")
public class DeviceActions implements java.io.Serializable {

	private Integer deviceActionsId;
	private Device device;
	private String actionType;
	private String name;
	private Set<ActionParameters> actionParameterses = new HashSet<ActionParameters>(
			0);
	private Set<StatusActionsScript> statusActionsScripts = new HashSet<StatusActionsScript>(
			0);

	public DeviceActions() {
	}

	public DeviceActions(Device device, String actionType, String name) {
		this.device = device;
		this.actionType = actionType;
		this.name = name;
	}

	public DeviceActions(Device device, String actionType, String name,
			Set<ActionParameters> actionParameterses,
			Set<StatusActionsScript> statusActionsScripts) {
		this.device = device;
		this.actionType = actionType;
		this.name = name;
		this.actionParameterses = actionParameterses;
		this.statusActionsScripts = statusActionsScripts;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "deviceActionsId", unique = true, nullable = false)
	public Integer getDeviceActionsId() {
		return this.deviceActionsId;
	}

	public void setDeviceActionsId(Integer deviceActionsId) {
		this.deviceActionsId = deviceActionsId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "deviceId", nullable = false)
	@NotNull
	public Device getDevice() {
		return this.device;
	}

	public void setDevice(Device device) {
		this.device = device;
	}

	@Column(name = "actionType", nullable = false, length = 32)
	@NotNull
	@Length(max = 32)
	public String getActionType() {
		return this.actionType;
	}

	public void setActionType(String actionType) {
		this.actionType = actionType;
	}

	@Column(name = "name", nullable = false, length = 100)
	@NotNull
	@Length(max = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "deviceActions")
	public Set<ActionParameters> getActionParameterses() {
		return this.actionParameterses;
	}

	public void setActionParameterses(Set<ActionParameters> actionParameterses) {
		this.actionParameterses = actionParameterses;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "deviceActions")
	public Set<StatusActionsScript> getStatusActionsScripts() {
		return this.statusActionsScripts;
	}

	public void setStatusActionsScripts(
			Set<StatusActionsScript> statusActionsScripts) {
		this.statusActionsScripts = statusActionsScripts;
	}

}
